package com.link2room.optimus.dto.result.api;





import com.link2room.ironhide.dto.result.base.L2RHotelRmtypePictureDto;
import com.link2room.ironhide.dto.result.base.L2RRoomtypeDto;

import java.math.BigDecimal;
import java.util.List;

/**
 * Created by sss on 2016/9/12.
 */
public class MarketingApiRmtypeDtoL2R extends L2RRoomtypeDto implements Comparable<MarketingApiRmtypeDtoL2R>{
    private BigDecimal rmtypeMinPrice;

    /**
     * 前端VUE需求
     */
    private String isShow="F";

    private Boolean saleNumEnough;

    private L2RHotelRmtypePictureDto bigPic;

    private List<L2RHotelRmtypePictureDto> pics;

    private List<MarketingApiDetailDto> marketingApiDetails;

    public List<MarketingApiDetailDto> getMarketingApiDetails() {
        return marketingApiDetails;
    }

    public void setMarketingApiDetails(List<MarketingApiDetailDto> marketingApiDetails) {
        this.marketingApiDetails = marketingApiDetails;
    }

    public BigDecimal getRmtypeMinPrice() {
        return rmtypeMinPrice;
    }

    public void setRmtypeMinPrice(BigDecimal rmtypeMinPrice) {
        this.rmtypeMinPrice = rmtypeMinPrice;
    }

    public L2RHotelRmtypePictureDto getBigPic() {
        return bigPic;
    }

    public void setBigPic(L2RHotelRmtypePictureDto bigPic) {
        this.bigPic = bigPic;
    }

    public List<L2RHotelRmtypePictureDto> getPics() {
        return pics;
    }

    public void setPics(List<L2RHotelRmtypePictureDto> pics) {
        this.pics = pics;
    }

    public String getIsShow() {
        return isShow;
    }

    public void setIsShow(String isShow) {
        this.isShow = isShow;
    }

    public Boolean getSaleNumEnough() {
        return saleNumEnough;
    }

    public void setSaleNumEnough(Boolean saleNumEnough) {
        this.saleNumEnough = saleNumEnough;
    }

    /*@Override
    public int compareTo(MarketingApiRmtypeDtoL2R o) {
        System.out.println("当前："+this.getRmtype()+"比较房型："+o.getRmtype());
        System.out.println("当前价格："+this.rmtypeMinPrice+"比较价格："+o.getRmtypeMinPrice());
        if(rmtypeMinPrice==null){
            return 1;
        }else {
            if(o.getRmtypeMinPrice()!=null){
                if (this.rmtypeMinPrice.compareTo(o.getRmtypeMinPrice())>0) {
                    System.out.println("大："+this.rmtypeMinPrice.subtract(o.getRmtypeMinPrice()));
                    return (this.rmtypeMinPrice.subtract(o.getRmtypeMinPrice())).intValue();
                }
                if (this.rmtypeMinPrice.compareTo(o.getRmtypeMinPrice())<0) {
                    System.out.println("小："+this.rmtypeMinPrice.subtract(o.getRmtypeMinPrice()));
                    return (this.rmtypeMinPrice.subtract(o.getRmtypeMinPrice())).intValue();
                }
            }else {
                return -1;
            }
        }
        if (saleNumEnough.compareTo(o.getSaleNumEnough())>=0) {
            System.out.println("有房：");
            return -2;
        }
        if (saleNumEnough.compareTo(o.getSaleNumEnough())<0) {
            System.out.println("无房：");
            return 2;
        }
        return 0;
    }*/

    @Override
    public int compareTo(MarketingApiRmtypeDtoL2R o) {
        int i=0;
        if (saleNumEnough.compareTo(o.getSaleNumEnough())<0) {
            i=i+9999;
        }
        if(rmtypeMinPrice!=null){
            if(o.getRmtypeMinPrice()!=null){
                if (this.rmtypeMinPrice.compareTo(o.getRmtypeMinPrice())>0) {
                    i= i+(this.rmtypeMinPrice.subtract(o.getRmtypeMinPrice())).intValue();
                }
                if (this.rmtypeMinPrice.compareTo(o.getRmtypeMinPrice())<0) {
                    i=i+(this.rmtypeMinPrice.subtract(o.getRmtypeMinPrice())).intValue();
                }
            }else {
                return -1;
            }
        }
        return i;
    }
}
